package com.yufei.infoExtractor.extractor.fetchdecision;

import java.util.Map;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.yufei.infoExtractor.extractor.UrlExtractor;
import com.yufei.infoExtractor.util.EncryptUtil;

public class DecideByIsHadFetched implements FetchDecisionMaker {
	private static final Log mLog = LogFactory.getLog(DecideByIsHadFetched.class);

	@Override
	public boolean makeDecision(Map context, String currentUrlStr) {
		// TODO Auto-generated method stub
		Set<String> linkFingerPrints = (Set<String>) context
				.get("linkFingerPrints");
		if(!linkFingerPrints.contains(EncryptUtil.md5(currentUrlStr))){
			return true;
		}
		else{
			mLog.debug("链接'"+currentUrlStr+"'已经被解析过，此次处理直接忽略");
			return false;

		}
	}

}
